package com.example.hightfrequencydemon;

import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class TestAnimationActivity extends Activity {

	private ImageView mImageView;
	private AnimationDrawable mAnimaition;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_animation_layout);

		mImageView = (ImageView) findViewById(R.id.imageView);
		mImageView
				.setBackgroundResource(R.drawable.animation_listanimation_list);
		mAnimaition = (AnimationDrawable) mImageView.getBackground();
		mAnimaition.start();
		
		
		// mImageView.post(new Runnable() {
		// @Override
		// public void run() {
		// mAnimaition.start();
		// }
		// });

	}

	public void imageViewonClick(View view) {

		if (mAnimaition.isRunning() == true) {
			mAnimaition.stop();
			mAnimaition.selectDrawable(0);
		} else {
			mAnimaition.start();
		}
		
		
		// mImageView.post(new Runnable() {
		// @Override
		// public void run() {
		// mAnimaition.start();
		// }
		// });
	}
}
